#ifndef _PAINT_IMAGE_H_
#define _PAINT_IMAGE_H_

#include <QWidget>
#include <QMouseEvent>
#include <QPainter>
#include <QLabel>
#include "Filter.h"
class PaintImage : public QWidget
 {
     Q_OBJECT

 public:
	 PaintImage(QWidget *parent = 0);
	 void applyFilter(Filter*);
	 const QImage& getImage() {return image;}
	 QPoint getLastPoint(){return lastPoint;}
	 void openImage(QImage& newImage);
     bool openImage(const QString &fileName);
     bool saveImage(const QString &fileName, const char *fileFormat);
     void setPenColor(const QColor &newColor);
     void setPenWidth(int newWidth);
	 const QString getCurrentTool();
     bool isModified() const { return modified; }
     QColor penColor() const { return myPenColor; }
     int penWidth() const { return myPenWidth; }
	 static QColor myPenColor;

 public slots:
     void clearImage();
     void print();

 protected:
     void mousePressEvent(QMouseEvent *event);
     void mouseMoveEvent(QMouseEvent *event);
     void mouseReleaseEvent(QMouseEvent *event);
     void paintEvent(QPaintEvent *event);
     void resizeEvent(QResizeEvent *event);

 private:
     void drawLineTo(const QPoint &endPoint);
     void resizeImage(QImage *image, const QSize &newSize);

     bool modified;
     bool scribbling;
     int myPenWidth;
     QImage image;
     QPoint lastPoint;
 };



#endif